package com.gt.web.controller.app.login;

import com.gt.common.app.WXUser;
import com.gt.common.core.domain.AjaxResult;
import com.gt.common.core.domain.entity.SysUser;
import com.gt.common.utils.SecurityUtils;
import com.gt.common.utils.StringUtils;
import com.gt.common.utils.bean.BeanUtils;
import com.gt.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户信息修改 前端控制器
 * </p>
 *
 * @author caidesheng
 */
@Slf4j
@RestController
@RequestMapping("user")
@Api(tags = "用户信息接口")
public class UserInfoController {

    @Autowired
    private ISysUserService iSysUserService;

    @ApiOperation(value = "修改用户信息")
    @PostMapping(value = "updateUserInfo")
    public AjaxResult updateUserInfo(@RequestBody WXUser wxUser) {

        return AjaxResult.success(iSysUserService.updateUserInfo(wxUser));
    }

    @ApiOperation(value = "获取当前用户信息")
    @GetMapping(value = "getUserInfo")
    public AjaxResult getUserInfo() {
        SysUser sysUser = iSysUserService.selectUserById(SecurityUtils.getUserId());
        return AjaxResult.success(sysUser);
    }

}
